//定义全局变量
 var user_session="";//储存用户登录信息，判断是否登录
//前端文件路径吧、配置js
var config = {

    imgPath:'../../app/api/',//图片地址
    interface: {
        api: 'http://localhost/thinkphp/index.php/api/data/index.html',//节数，类型接口地址

    },


};

//点击刷新
function refresh() {
    window.location.reload();

}
//获取当前时间
function getNowFormatDate() {//获取当前时间
    var date = new Date();
    var seperator1 = "-";
    var seperator2 = ":";
    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
    var strDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate
        + " " + date.getHours() + seperator2 + date.getMinutes()
        + seperator2 + date.getSeconds();
    return currentdate;

}
//js将php时间戳转换成格式化日期
function to_date(phpstr) {
    str = parseInt(phpstr) * 1000;//将php时间戳转化为整形并乘以1000
    var newDate = new Date(str);
    var year = newDate.getUTCFullYear();//取年份
    var month = newDate.getUTCMonth() + 1;//取月份
    var nowday = newDate.getUTCDate();//取天数
    var hours = newDate.getHours();//取小时
    var minutes = newDate.getMinutes();//取分钟
    var seconds = newDate.getSeconds();//取秒
    if (phpstr == null) {
        return "暂无记录";
    }
    else {
        return year + "-" + month + "-" + nowday + " " + hours + ":" + minutes + ":" + seconds;//拼接 2017-2-21 12:23:43
    }

}